<?php
/**
 * Created by PhpStorm.
 * User: hui
 * Date: 2017/2/18
 * Time: 16:42
 */

namespace app\index\controller;

use think\Controller;

class Base extends Controller
{
    public function _initialize()
    {
        parent::_initialize();
        $menu = db('system_menu')
            ->cache(true,60)
            ->select();
        $res = db('system')
            ->cache(true,60)
            ->where('class','system')
            ->select();
        $path = '/' == request()->path() ? 'csgo' : request()->path();
        $active = db('system_menu')
            ->cache(true,60)
            ->where('url',$path)
            ->find();
        $system = [];
        foreach ($res as $item){
            $system[$item['name']] = $item['value'];
        }
        $this->assign('active',$active);
        $this->assign('system',$system);
        $this->assign('menu',$menu);
    }
}